home *** CD-ROM | disk | FTP | other *** search
- # floating.hlp
- #
- # floating and floating-ext wordsets
- #
- # L.C. Benschop 24 sep 1994.
- #
- # In all stack comments, floats are assumed to be on a separate stack.
-
-
- : >FLOAT ( c-addr u --- true|false ) ( F: --- r| ) [FLOATING]
- Attempt to convert the character string described by c-addr and u to a
- floating point number. If the conversion is successful then a true
- flag and r are returned, otherwise only false is returned.
-
- If the string consists of all blanks, it is converted to zero.
-
- The number may start with an optional plus or minus sign. It must
- contain at least one digit, either before or after the point.
- The decimal point is optional. The number may end with an exponent part,
- which starts with one of the letters E, e, D or d. This is followed
- by an optional plus or minus sign, followed by zero or more digits.
- The exponent letter may be omitted if the exponent sign is present.
- If there are no digits in the exponent part, it is treated as zero.
-
-
- : D>F ( d --- ) ( F: --- r ) [FLOATING]
- Convert d to a floating point number. If d cannot be represented exactly,
- there is an ambiguous condition.
-
-
- : F! ( f-addr --- ) ( F: r --- ) [FLOATING]
- Store r at address f-addr.
-
-
- : F* ( F: r1 r2 --- r3 ) [FLOATING]
- multiply r1 and r2.
- Shouldn't there be an ambiguous condition if overflow?
-
-
- : F+ ( F: r1 r2 --- r3 ) [FLOATING]
- Add r1 and r2
- Shouldn't there be an ambiguous condition if overflow?
-
-
- : F- ( F: r1 r2 --- r3 ) [FLOATING]
- Subtract r2 from r1.
- Shouldn't there be an ambiguous condition if overflow?
-
-
- : F/ ( F: r1 r2 --- r3 ) [FLOATING]
- Divide r1 by r2.
- If result overflows of r2 is zero, there is an ambiguous condition.
-
-
- : F0< ( --- flag ) ( F: r --- ) [FLOATING]
- flag is true if and only if r is less than zero.
-
-
- : F0= ( --- flag ) ( F: r --- ) [FLOATING]
- flag is true if and only if r is equal to zero.
-
-
- : F< ( --- flag ) ( F: r1 r2 --- ) [FLOATING]
- flag is true if and only if r1 is less than f2.
-
-
- : F>D ( --- d ) ( F: r --- ) [FLOATING]
- Convert the integer portion of r to double, discard the fractional part.
- If r is outside the range of double numbers, there is an
- ambiguous condition.
-
-
- : F@ ( f-addr --- ) ( F: --- r ) [FLOATING]
- Fetch the value r from address f-addr.
-
-
- : FALIGN ( --- ) [FLOATING]
- Adjust the data space pointer such that it points to a
- float-aligned address.
-
-
- : FALIGNED ( addr --- f-addr ) [FLOATING]
- f-addr is the first float-aligned address equal to or higher than
- addr.
-
-
- : FCONSTANT ( "<spaces>name" --- ) ( F: r --- ) [FLOATING]
- Parse name delimited by space and create a definition for name that,
- when executed, pushes r onto the floating point stack.
-
- name execution: ( F: --- r )
-
-
- : FDEPTH ( --- +n ) [FLOATING]
- +n is the number of numbers on the floating point stack.
-
-
- : FDROP ( F: r --- ) [FLOATING]
- Discard top element from the floating point stack.
-
-
- : FDUP ( F: r --- r r ) [FLOATING]
- Duplicate the top element of the floating point stack.
-
-
- : FLITERAL [FLOATING]
- Using FLITERAL while interpreting is an error.
-
- Compilation: ( F: r --- )
- FLITERAL is an immediate word. Append the following runtime behavior
- to the current definition.
-
- Runtime: ( F: --- r )
-
-
- : FLOAT+ ( f-addr1 --- f-addr2 ) [FLOATING]
- Increment f-addr1 by the size of one floating point number.
-
-
- : FLOATS ( n1 --- n2 ) [FLOATING]
- Convert number of floating point numbers to the size in address
- units.
-
-
- : FLOOR ( F: r1 --- r2 ) [FLOATING]
- Round r1 to the largest integer not greater than r2.
-
-
- : FMAX ( F: r1 r2 --- r3 ) [FLOATING]
- r3 is the maximum of r1 and r2.
-
-
- : FMIN ( F: r1 r2 --- r3 ) [FLOATING]
- r3 is the minimum of r1 and r2.
-
-
- : FNEGATE ( F: r1 --- r2 ) [FLOATING]
- r2 is the negation of r1/
-
-
- : FOVER ( F: r1 r2 --- r1 r2 r1 ) [FLOATING]
- Copy the second number of the floating point stack to the top.
-
-
- ; FROT ( F: r1 r2 r3 --- r2 r3 r1 ) [FLOATING]
- Rotate the three top numbers on the floating point stack.
-
-
- : FROUND ( F: r1 --- r2 ) [FLOATING]
- Round r1 to the nearest integer. If r1 is exactly halfway
- between to integers, the even integer is chosen.
-
-
- : FSWAP ( F: r1 r2 --- r2 r1 ) [FLOATING]
- Swap the two top numbers on the floating point stack.
-
-
- : FVARIABLE ( "<spaces>name" --- ) [FLOATING]
- Parse name delimited by spaces and create a definition for name that
- pushes f-addr onto the stack. f-addr is the address of a reserved data
- space where a floating point number may be stored.
-
- name execution: ( --- f-addr )
-
-
- : REPRESENT ( c-addr u --- n flag1 flag2 ) ( F: r --- ) [FLOATING]
- Convert r to a decimal character representation and place that at
- c-addr. The representation consists of the u most significant digits,
- the first of which is nonzero; only if r=0, the representation consists
- of all zeros. flag2 is true if r is in the range of convertible numbers.
- flag1 is true if r is negative. n is the decimal exponent of r. n=0
- if abs(r) is greater than or equal to 0.1 and less than 1.0.
-
- r is rounded to the nearest number that can be represented in u
- significant digits prior to conversion; n reflects the situation after
- rounding.
-
- If flag2 is false, then n, flag1 and the string at c-addr are
- implementation-defined. The string at c-addr always consists of graphic
- ASCII characters.
-
- BASE must contain 10, else there is an ambiguous condition.
-
-
- : DF! ( df-addr --- ) ( F: r --- ) [FLOATING EXT]
- Store r at df-addr as an IEEE double precision number. If
- r has more significant bits than the IEEE double precision number,
- it is rounded to the nearest such number. If r is outside the range
- of IEEE double precision numbers, there is an ambiguous condition.
-
-
- : DF@ ( df-addr --- ) ( F: --- r ) [FLOATING EXT]
- Fetch the double precision number stored at df-addr and convert
- it to r. If the IEEE double precision number has more significant
- bits than r, it is rounded to the nearest floating point value.
- If the IEEE double precision number is outside the range of
- floating point numbers, there is an ambiguous condition.
-
-
- : DFALIGN ( --- ) [FLOATING EXT]
- Adjust the data space pointer such that it points to a double
- float aligned address.
-
-
- : DFALIGNED ( addr --- df-addr ) [FLOATING EXT]
- df-addr is the first double float-aligned address greater than
- or equal to addr.
-
-
- : DFLOAT+ ( df-addr1 --- df-addr2) [FLOATING EXT]
- Increment df-addr1 by the size of one IEEE double precision
- floating point number.
-
-
- : DFLOATS ( n1 --- n2 ) [FLOATING EXT]
- Convert number of IEEE double precision floating point numbers
- to the size in address units.
-
-
- : F** ( F: r1 r2 --- r3 ) [FLOATING EXT]
- Raise r1 to the power of r2.
-
-
- : F. ( F: r --- ) [FLOATING EXT]
- Display r in a fixed point format with a trailing space.
-
- If BASE does not contain 10 or if the character string representation
- is larger than the pictured number output buffer, there is an
- ambiguous condition.
-
-
- : FABS ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the absolute value of r1.
-
-
- : FACOS ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the inverse cosine of r1 in radians. abs(r1) must not be
- greater than 1.0, else there is an ambiguous condition.
-
-
- : FACOSH ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the inverse hyperbolic cosine of r1. r1 must be at least
- one, else an ambiguous condition exists.
-
-
- : FALOG ( F: r1 --- r2 ) [FLOATING EXT]
- Raise ten to the power of r1 (inverse logarithm).
-
-
- : FASIN ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the inverse sine of r1 in radians. abs(r1) must not be
- greater than 1.0, else there is an ambiguous condition.
-
-
- : FASINH ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the inverse hyperbolic sine of r1. If r1 is less than zero,
- there is an ambiguous condition. (why?)
-
-
- : FATAN ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the inverse tangent of r1 in radians.
-
-
- : FATAN2 ( F: r1 r2 --- r3 ) [FLOATING EXT]
- Compute the angle r3 in radians whose sine and cosine have the
- same signs and ratio as r1 and r2. If r1 and r2 are both zero,
- there is an ambiguous condition.
-
-
- : FATANH ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the inverse hyperbolic tangent of r1. If abs(r1) is
- greater than 1.0, there is an ambiguous condition.
-
-
- : FCOS ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the cosine of r1 (r1 in radians).
-
-
- : FCOSH ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the hyperbolic cosine of r1.
-
-
- : FE. ( F: r --- ) [FLOATING EXT]
- Display r in engineering format, which is similar to scientific
- format, but where the significand lies between 1.0 and 1000.0 and
- where the decimal exponent is a multiple of 3.
-
- If BASE does not contain 10 or if the character string representation
- is larger than the pictured number output buffer, there is an
- ambiguous condition.
-
-
- : FEXP ( F: r1 --- r2 ) [FLOATING EXT]
- Raise e to the power of r1 (inverse natural logarithm).
-
-
- : FEXPM1 ( F: r1 --- r2 ) [FLOATING EXT]
- Raise e to the power of r1 and subtract one.
-
-
- : FLN ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the natural logarithm of r1. r1 must be greater than zero,
- else there is an ambiguous condition.
-
-
- : FLNP1 ( F: r1 --- r2 ) [FLOATING EXT]
- Add one to r1 and compute the natural logarithm. r1 must be
- greater than -1.0, else there is an ambiguous condition.
-
-
- : FLOG ( F: r1 --- r2 )
- Compute the base-10 logarithm of r1. r1 must be greater than zero,
- else there is an ambiguous condition.
-
-
- : FS. ( F: r --- ) [FLOATING EXT]
- Display r in scientific format with a trailing space. The
- number starts with an optional minus sign, followed by a digit, a
- decimal point, more digits, the letter E, an optional minus sign
- and the digits of the decimal exponent.
-
- If BASE does not contain 10 or if the character string representation
- is larger than the pictured number output buffer, there is an
- ambiguous condition.
-
-
- : FSIN ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the sine of r1 (r1 in radians).
-
-
- : FSINCOS ( F: r1 --- r2 r3 ) [FLOATING EXT]
- r1 is the angle in radians. r2 is the sine and r3 the cosine.
-
-
- : FSINH ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the hyperbolic sine of r1.
-
-
- : FSQRT ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the square root of r1. If r1 is less than zero, there is
- an ambiguous condition.
-
-
- : FTAN ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the tangent of r1. (r1 in radians) If cos(r1) is zero,
- there is an ambiguous condition.
-
-
- : FTANH ( F: r1 --- r2 ) [FLOATING EXT]
- Compute the hyperbolic tangent of r1.
-
-
- : F~ ( --- flag ) ( r1 r2 r3 --- ) [FLOATING EXT]
- flag is true if and only if r1 and r2 are sufficiently close within
- the tolerance r3. If r3>0, then r3 is an absolute tolerance
- (absolute difference between r1 and r2 must not be more than r3). If
- r3=0, then r1 and r2 must be exactly equal. If r3<0, it is a relative
- tolerance (difference between r1 and r2 must not be more than
- r3*(r1+r2) ).
-
-
- : PRECISION ( --- u ) [FLOATING EXT]
- u is the number of significant digits used by F. FE. and FS.
-
-
- : SET-PRECISION ( u --- ) [FLOATING EXT]
- Set the number of significant digits used by F, FE. and FS.
-
-
- : SF! ( sf-addr --- ) ( F: r --- ) [FLOATING EXT]
- Store r at sf-addr as an IEEE single precision number. If
- r has more significant bits than the IEEE single precision number,
- it is rounded to the nearest such number. If r is outside the range
- of IEEE single precision numbers, there is an ambiguous condition.
-
-
- : SF@ ( sf-addr --- ) ( F: --- r ) [FLOATING EXT]
- Fetch the single precision number stored at sf-addr and convert
- it to r. If the IEEE single precision number has more significant
- bits than r, it is rounded to the nearest floating point value.
- If the IEEE single precision number is outside the range of
- floating point numbers, there is an ambiguous condition.
-
-
- : SFALIGN ( --- ) [FLOATING EXT]
- Adjust the data space pointer such that it points to a single
- float aligned address.
-
-
- : SFALIGNED ( addr --- sf-addr ) [FLOATING EXT]
- sf-addr is the first single float-aligned address greater than
- or equal to addr.
-
-
- : SFLOAT+ ( sf-addr1 --- sf-addr2) [FLOATING EXT]
- Increment sf-addr1 by the size of one IEEE single precision
- floating point number.
-
-
- : SFLOATS ( n1 --- n2 ) [FLOATING EXT]
- Convert number of IEEE single precision floating point numbers
- to the size in address units.
-